<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      body {
        width: 500px;
        margin: 0 auto;
      }

      p {
        background: aqua;
        border: 3px solid blue;
        padding: 10px;
        margin: 10px;
      }

      span {
        background: red;
        border: 1px solid black;
      }
      /* .positioned {
        position: relative;
        background: yellow;
        top: 30px;
        left: 30px;
      } */
      .positioned {
        position: absolute; /*绝对定位不再存在于文档流布局*/
        background: yellow;
        top: 30px;
        left: 30px;
      }
    </style>
  </head>
  <body>
    <!-- 
      绝对定位不再存在于文档流布局，绝对定位元素应该位于从“包含元素”

      绝对定位元素的“包含元素”取决于绝对定位元素的父级元素的position属性，
      如果所有父级元素都没有显示定义position属性，绝对定位元素会被放在html元素外面，根据浏览器视口来定位

      
    -->

    <h1>Basic document flow</h1>

    <p>I am a basic block level element. My adjacent block level elements sit on new lines below me.</p>

    <p class="positioned">
      By default we span 100% of the width of our parent element, and we are as tall as our child content. Our total
      width and height is our content + padding + border width/height.
    </p>

    <p>
      We are separated by our margins. Because of margin collapsing, we are separated by the width of one of our
      margins, not both.
    </p>

    <p>
      inline elements
      <span>like this one</span>
      and
      <span>this one</span>
      sit on the same line as one another, and adjacent text nodes, if there is space on the same line. Overflowing
      inline elements will
      <span>wrap onto a new line if possible (like this one containing text)</span>
      , or just go on to a new line if not, much like this image will do:
      <img src="https://mdn.mozillademos.org/files/13360/long.jpg" />
    </p>
  </body>
</html>
